using System.Collections.Generic;
using System.Xml;
using ICSharpCode.TextEditor.Document;

namespace Byond.Frontend.Controls
{
	public class SyntaxModeProvider : ISyntaxModeFileProvider
	{
		public SyntaxModeProvider()
		{
			//var syntaxModeStream = typeof(AvalonEditor).Assembly.GetManifestResourceStream(
			//    "Byond.Shell.Controls.SyntaxModes.xml");
			//SyntaxModes = SyntaxMode.GetSyntaxModes(syntaxModeStream);
			SyntaxModes = new List<SyntaxMode>
				{
					new SyntaxMode("XmlDoc2.xshd", "XmlDoc2", ""),
					new SyntaxMode("CSLight.xshd", "CSLight", ""),
					new SyntaxMode("Xaml.xshd", "XAML", "")
				};
		}

		public ICollection<SyntaxMode> SyntaxModes { get; private set; }

		public XmlTextReader GetSyntaxModeFile(SyntaxMode syntaxMode)
		{
			var stream = typeof(AvalonEditor).Assembly.GetManifestResourceStream("Byond.Shell.Controls." + syntaxMode.FileName);
			return new XmlTextReader(stream);
		}

		public void UpdateSyntaxModeList()
		{
			// resources don't change during runtime
		}
	}
}